#pragma once
#include <iostream>
#include <ctime>
#include <vector>

typedef void (*task_t)();

void Print1() {
    std::cout << "这是任务1" << std::endl;
}

void Print2() {
    std::cout << "这是任务2" << std::endl;
}

void Print3() {
    std::cout << "这是任务3" << std::endl;
}

class TaskManger 
{
public:
    TaskManger() {
        srand(time(nullptr));
    }
    void Register(task_t t) {
        _task.push_back(t);
    }
    int Code() {
        
        return rand() % _task.size();
    }
    void Execute(int code) {
        if(code >= 0 && code < _task.size()) {
            _task[code]();
        }
    }
    ~TaskManger() {

    }
private:
    std::vector<task_t> _task;
};